import Vue from 'vue'
import VueRouter from "vue-router";

import Layout from '@/views/layout'
import Collect from '@/views/collect'
import Like from '@/views/like'
import User from '@/views/user'
import Article from '@/views/article'
import Detail from '@/views/article-detail'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
  // 重定向
    {
      path: '/',
      redirect:'/article'
    },
  // 一级路由
    {
      name:'Layout',
      path: '/layout',
      component: Layout,
      // 二级路由
      children: [
        {
          name:'Collect',
          path: '/collect',
          component:Collect
        },
        {
          name:'Like',
          path: '/Like',
          component:Like
        },
        {
          name:'user',
          path: '/user',
          component:User
        },
        {
          name:'Article',
          path: '/article',
          component:Article
        },
      ]
    },
    {
      path: '/detail/:id',
      component:Detail
    },
  ]
})

export default router